<template>
	<view>

		<!-- <view class="head">
			<view @click="goBack" class="goBack">
				<image src="../../../static/img/waitingMaintain/maintain2.png" mode=""></image>
			</view>
			<view class="head_title">我的保养</view>
			<navigator url="#" class="head_right">
				<image src="../../../static/img/waitingMaintain/maintain2.png" mode=""></image>
			</navigator>
		</view> -->
		<view class="" style="width: 100%; padding: 10px 20px;box-sizing: border-box;" v-if="recordList.length > 0">
			<uni-card class="m10" v-for="(item,index) in recordList" :key="index"   >
				<view class="record"  @click="verticalLadder(item.upkeepId,item.upkeepState)">
					<view class="record-address">
						{{item.elevatorName}}
						<text v-if="item.upkeepType == 1">半月保养</text>
						<text v-else-if="item.upkeepType == 2">季度保养</text>
						<text v-else-if="item.upkeepType == 3">半年保养</text>
						<text v-else>年度保养</text>
					</view>

					<view class="information">
						<!-- left -->
						<view class="information-left">
							<view class="record-time">
								确认时间:
								<text>{{item.confirmDate || "暂无"}}</text>
							</view>
							<view class="record-time p10">
								保养人:
								<text>{{item.referUser || "暂无"}}</text>
							</view>
							<view class="record-time">
								审核人:
								<text>{{item.auditUser || '暂无'}}</text>
							</view>
						</view>
						<!-- 已完成 right-->
						<!-- <view class="successState">
							<image src="../../../static/img/icon_confirmcomplete.png" mode=""></image>
							<view class="">
								<text v-if="item.upkeepState">完成</text>
								<text v-else>不通过</text>
							</view>
						</view> -->
					</view>
				</view>
			</uni-card>
		</view>
		<view v-else>
			<null-page></null-page>
		</view>
		

	</view>
</template>

<script>
	import mymaintain from "@/serve/api/mymaintain.js";
	
	import nullPage from '@/common/null.vue'
	export default {
		components:{
			nullPage
		},
		data() {
			return {
				// 内容
				getListFlag: true,
				pageNum: 1,
				recordList: []
			}
		},
		onLoad() {
			this.getrecordData();
		},
		methods: {
			async getrecordData() {
				let parme = {
					pageNum: this.pageNum,
					pageSize: 7,
				}
				const res = await mymaintain.selectMineUpkeepList(parme)
				console.log('565656',res)
				this.recordList = this.recordList.concat(res.data.data.list)
				if (res.data.data.list.length < 7 && this.recordList.length > 0) {
					uni.showToast({
						title: '已加载全部',
						icon: 'none'
					})
				} else if (res.data.data.list == []) {
					uni.showToast({
						title: '暂无数据',
						icon: 'none'
					})
				}
			},
			verticalLadder(upkeepId,status) {
				if (status == 3) {
					uni.navigateTo({
						url: "/pages/gird/verticalLadder/verticalLadder_perform?upkeepId=" + upkeepId
					})
				} else {
					uni.navigateTo({
						url: "/pages/gird/verticalLadder/verticalLadder?upkeepId=" + upkeepId
					})
				}
			
			}
		},
		onReachBottom(e) {
			if (this.getListFlag) {
				this.pageNum = this.pageNum + 1;
				this.getrecordData();
			}
		},
		
	}
</script>

<style scoped>
	* {
		margin: 0;
		padding: 0;
	}

	page {
		width: 750rpx;
		background: #EFF2F5;
		overflow: hidden;
	}

	view {
		font-size: 28rpx;
		line-height: 1.8;

	}

	/* 导航栏 */


	.uni-icons {
		color: #3AC211;
	}

	.uni-card {
		width: 100%;
		/* height: 280rpx; */
		border: none;
		background: #FFFFFF;
		box-shadow: 0rpx 10rpx 10rpx 0rpx rgba(52, 54, 61, 0.05);
		border-radius: 16rpx;
		margin: 0 auto;
		margin-top: 20rpx;
		line-height: 280rpx;
		text-align: left;
	}

	.record {
		font-family: PingFang SC;
		font-weight: 400;
		/* margin: 40rpx 0; */
	}

	.record-address {
		font-size: 30rpx;
		color: #34363D;
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	}

	.record-address text {
		color: #017EFE;
	}

	/* 		.record-state{
			font-size: 30rpx;
			color: #017EFE;	
		} */
	/* 左右 信息*/
	.information {
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-wrap: nowrap;
	}

	.record-time {
		/* width: 92px; */
		font-size: 24rpx;
		color: #989BA6;
	}

	.successState {
		background: #3AC211;
		width: 150rpx;
		height: 56rpx;
		text-align: center;
		box-shadow: 0px 5px 10px 0px rgba(58, 194, 17, 0.2);
		border-radius: 28rpx;
		color: #FFFFFF;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
	}

	.successState image {
		width: 30rpx;
		height: 30rpx;
		background: #3AC211;
		border-radius: 10rpx;
		vertical-align: middle;
	}

	.successState text {
		font-size: 24rpx;
		margin-left: 10rpx;
	}

	.record-time text {
		margin-left: 15rpx;
		color: #34363D;
		word-spacing: 15rpx;
		letter-spacing: 1rpx;
	}

	.p10 {
		padding: 7px 0;
	}

	.m10 {
		margin: 25px 0;
	}
</style>
